/**
 * 
 */
package com.toncen.samepms.fisher.condition;

import com.sky.fisher.condition.AbstractCondition;
import com.sky.fisher.condition.ConditionEnum;
import com.sky.fisher.model.CommonColumnModel;

/**
 * 组织类型相等条件
 * 
 * @author tch
 * 
 */
public class OrganizationTypeLikeCondtion extends AbstractCondition {

	public OrganizationTypeLikeCondtion() {
		super(ConditionEnum.STRING_LIKE);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.sky.fisher.filter.AbstractCondition#getConditionSQL(com.sky.fisher.model.CommonColumnModel,
	 *      java.lang.String)
	 */
	@Override
	public String getConditionSQL(CommonColumnModel column, String value) throws Exception {
		StringBuffer conditionSQL = new StringBuffer();
		conditionSQL.append(" and " + column.getField() + " in " + //
				"(" + //
				" select organization_id from basic_organization, basic_organization_type	" + //
				" where basic_organization_type.type = " + value + " " + //
				" and basic_organization.id = basic_organization_type.organization_id	" + //
				" ) ");
		return conditionSQL.toString();
	}

}
